package com.example.service;

import com.example.entity.User;

import java.util.List;

public class SqlProvider {
   public String insertListSQL(List<User> userList) {
        StringBuilder sqlList = new StringBuilder();
       sqlList.append("INSERT INTO USER (user_name,pass_word,real_name,display_name,url) VALUES ");
       int listSize =userList.size();
       for (int i = 0; i < listSize; i++) {
           sqlList.append(" (").append("'").append(userList.get(i).getUserName()).append("'").append(",").append("'").append(userList.get(i).getPassWord()).append("'").append(",").append("'").append(userList.get(i).getRealName()).append("'").append(",").append("'").append(userList.get(i).getDisplayName()).append("'").append(",").append("'").append(userList.get(i).getUrl()).append("'").append(")");
           if(i!=listSize-1){
               sqlList.append(",");
           }
         }
       return sqlList.toString();
    }
}
